﻿package mortal.game.scene3D.fight
{
    import flash.utils.*;
    import mortal.game.scene3D.buff.*;
    import mortal.game.scene3D.player.entity.*;

    public class FightChainUtil extends Object
    {
        public static var dicFightChain:Dictionary = new Dictionary();
        public static const CONNECT:String = "#";

        public function FightChainUtil()
        {
            return;
        }// end function

        public static function addChain(param1:SpritePlayer, param2:SpritePlayer, param3:String, param4:Number = 0) : String
        {
            var _loc_5:* = param1.entityID + CONNECT + param2.entityID + CONNECT + param3;
            if (!dicFightChain[_loc_5] && param1.entityInfo)
            {
                dicFightChain[_loc_5] = new ChainEffect(param3, param2, param1.entityInfo.entityInfo.entityId, true);
                if (param4 > 0)
                {
                    setTimeout(removeChain, param4, _loc_5);
                }
            }
            return _loc_5;
        }// end function

        public static function removeChainByEntity(param1:SpritePlayer, param2:SpritePlayer, param3:String) : void
        {
            var _loc_4:* = param1.entityID + CONNECT + param2.entityID + CONNECT + param3;
            removeChain(_loc_4);
            return;
        }// end function

        public static function removeChain(param1:String) : void
        {
            var _loc_2:ChainEffect = null;
            if (dicFightChain[param1])
            {
                _loc_2 = dicFightChain[param1];
                _loc_2.dispose();
                delete dicFightChain[param1];
            }
            return;
        }// end function

        public static function clearAll() : void
        {
            var _loc_1:String = null;
            var _loc_2:ChainEffect = null;
            for (_loc_1 in dicFightChain)
            {
                
                _loc_2 = dicFightChain[_loc_1];
                _loc_2.dispose();
                delete dicFightChain[_loc_1];
            }
            return;
        }// end function

    }
}
